package com.xxzb.pack0819;



import java.io.*;
import java.util.Arrays;

//使用IO流实现：将D盘下的a.jpg复制到E盘中
public class TestA {
    public static void a() throws Exception{
        File file=new File("D:\\a.jpg");
        InputStream in=new FileInputStream(file);
        byte[] bytes=new byte[1024];
        String str="";
        int len;
        while ((len=in.read(bytes))!=-1){
            System.out.println(Arrays.toString(bytes));
        }
        System.out.println(str);

        File file1=new File("E:\\a.jpg");
        OutputStream out=new FileOutputStream(file1);
        byte[] bytes1=str.getBytes();
        out.write(bytes1);
        out.close();
        in.close();
    }


    public static void main(String[] args) throws Exception{
a();
    }
}
